/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.gov.igac.observatorio.entidades.idea;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author jgamba
 */
@Entity
@Table(name = "subarea")
@NamedQueries({
    @NamedQuery(name = "Subarea.findAll", query = "SELECT s FROM Subarea s"),
    @NamedQuery(name = "Subarea.findByIdSubArea", query = "SELECT s FROM Subarea s WHERE s.idSubArea = :idSubArea"),
    @NamedQuery(name = "Subarea.findByNombre", query = "SELECT s FROM Subarea s WHERE s.nombre = :nombre")})
public class Subarea implements Serializable {
    @OneToMany(mappedBy = "subarea")
    private List<Idea> ideaList;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idSubArea")
    private Integer idSubArea;
    @Size(max = 100)
    @Column(name = "nombre")
    private String nombre;
    @JoinColumn(name = "areaInvestigacion", referencedColumnName = "idAreaInvestigacion")
    @ManyToOne
    private Areainvestigacion areainvestigacion;
    @OneToMany(mappedBy = "subarea")
    private List<Subarea1> subarea1List;

    public Subarea() {
    }

    public Subarea(Integer idSubArea) {
        this.idSubArea = idSubArea;
    }

    public Integer getIdSubArea() {
        return idSubArea;
    }

    public void setIdSubArea(Integer idSubArea) {
        this.idSubArea = idSubArea;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Areainvestigacion getAreainvestigacion() {
        return areainvestigacion;
    }

    public void setAreainvestigacion(Areainvestigacion areainvestigacion) {
        this.areainvestigacion = areainvestigacion;
    }

    public List<Subarea1> getSubarea1List() {
        return subarea1List;
    }

    public void setSubarea1List(List<Subarea1> subarea1List) {
        this.subarea1List = subarea1List;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSubArea != null ? idSubArea.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Subarea)) {
            return false;
        }
        Subarea other = (Subarea) object;
        if ((this.idSubArea == null && other.idSubArea != null) || (this.idSubArea != null && !this.idSubArea.equals(other.idSubArea))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.nombre;
    }

    public List<Idea> getIdeaList() {
        return ideaList;
    }

    public void setIdeaList(List<Idea> ideaList) {
        this.ideaList = ideaList;
    }
    
}
